home *** CD-ROM | disk | FTP | other *** search
- /*
- * graphics.h --
- *
- * Defines for the graphics device.
- *
- * Copyright (C) 1989 by Digital Equipment Corporation, Maynard MA
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of Digital not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * Digitial disclaims all warranties with regard to this software, including
- * all implied warranties of merchantability and fitness. In no event shall
- * Digital be liable for any special, indirect or consequential damages or
- * any damages whatsoever resulting from loss of use, data or profits,
- * whether in an action of contract, negligence or other tortious action,
- * arising out of or in connection with the use or performance of this
- * software.
- *
- * $Header: devSerialPmax.c,v 1.4 89/05/22 13:31:07 mnelson Exp $ SPRITE (DECWRL)
- */
-
- /*
- * Defines for the system control and status register.
- *
- * SYS_CSR_ADDR The address where it lives.
- * SYS_CSR_MONO Bit to tell whether we have a monochrome or
- * a color frame buffer.
- */
- #define SYS_CSR_ADDR 0xbe000000
- #define SYS_CSR_MONO 0x0800
-
- /*
- * Cursor command register bits.
- *
- * CURSOR_ENPA Enable cursor plane A.
- * CURSOR_FOPA Force cursor plane A to output 1.
- * CURSOR_ENPB Enable cursor plane B.
- * CURSOR_FOPB Force cursor plane B to output 1.
- * CURSOR_XHAIR
- * CURSOR_XHCLP Clip crosshair inside region.
- * CURSOR_XHCL1 Select crosshair clipping region.
- * CURSOR_XHWID Crosshair cursor line width.
- * CURSOR_ENRG1 Enable region detector 1.
- * CURSOR_FORG1 Force region detector 1 to output 1.
- * CURSOR_ENRG2 Enable region detector 2.
- * CURSOR_FORG2 Force region detector 2 to output 1.
- * CURSOR_LODSA Load/display sprite array.
- * CURSOR_VBHI Vertical blank polarity.
- * CURSOR_HSHI Horizontal sync polarity.
- * CURSOR_TEST Diagnostic test.
- */
- #define CURSOR_ENPA 0x0001
- #define CURSOR_FOPA 0x0002
- #define CURSOR_ENPB 0x0004
- #define CURSOR_FOPB 0x0008
- #define CURSOR_XHAIR 0x0010
- #define CURSOR_XHCLP 0x0020
- #define CURSOR_XHCL1 0x0040
- #define CURSOR_XHWID 0x0080
- #define CURSOR_ENRG1 0x0100
- #define CURSOR_FORG1 0x0200
- #define CURSOR_ENRG2 0x0400
- #define CURSOR_FORG2 0x0800
- #define CURSOR_LODSA 0x1000
- #define CURSOR_VBHI 0x2000
- #define CURSOR_HSHI 0x4000
- #define CURSOR_TEST 0x8000
-
- /*
- * Physical addresses of entities in the memory map.
- */
- #define CURSOR_REG_ADDR 0xb1000000
- #define FRAME_BUF_ADDR 0xafc00000
- #define VDAC_ADDR 0xb2000000
- #define PLANE_MASK_ADDR 0xb0000000
-
- /*
- * The cursor register.
- */
- typedef volatile struct {
- unsigned short cmdReg; /* Command register. */
- unsigned short pad1;
- unsigned short xPos; /* X position. */
- unsigned short pad2;
- unsigned short yPos; /* Y position. */
- unsigned short pad3;
- unsigned short xMin1;
- unsigned short pad4;
- unsigned short xMax1;
- unsigned short pad5;
- unsigned short yMin1;
- unsigned short pad6;
- unsigned short yMax1;
- unsigned short pad7;
- unsigned short unused7;
- unsigned short padUnused7;
- unsigned short unused8;
- unsigned short padUnused8;
- unsigned short unused9;
- unsigned short padUnused9;
- unsigned short unusedA;
- unsigned short padUnusedA;
- unsigned short xMin2;
- unsigned short pad8;
- unsigned short xMax2;
- unsigned short pad9;
- unsigned short yMin2;
- unsigned short padA;
- unsigned short yMax2;
- unsigned short padB;
- unsigned short memory;
- unsigned short padC;
- } PCCRegs;
-
- /*
- * The VDAC register.
- */
- typedef volatile struct {
- unsigned char mapWA;
- unsigned char pad0;
- unsigned short pad1;
-
- unsigned char map;
- unsigned char pad2;
- unsigned short pad3;
-
- unsigned char mask;
- unsigned char pad4;
- unsigned short pad5;
-
- unsigned char mapRA;
- unsigned char pad6;
- unsigned short pad7;
-
- unsigned char overWA;
- unsigned char pad8;
- unsigned short pad9;
-
- unsigned char over;
- unsigned char pad10;
- unsigned short pad11;
-
- unsigned char reserved;
- unsigned char pad12;
- unsigned short pad13;
-
- unsigned char overRA;
- unsigned char pad14;
- unsigned short pad15;
- } VDACRegs;
-
- /*
- * Events.
- */
- typedef struct {
- short x; /* x position */
- short y; /* y position */
- unsigned int time; /* 1 millisecond units */
- unsigned char type; /* button up/down/raw or motion */
- unsigned char key; /* the key (button only) */
- unsigned char index; /* which instance of device */
- unsigned char device; /* which device */
- } Event;
-
- /*
- * type field
- */
- #define BUTTON_UP_TYPE 0
- #define BUTTON_DOWN_TYPE 1
- #define BUTTON_RAW_TYPE 2
- #define MOTION_TYPE 3
-
- /*
- * device field
- */
- #define NULL_DEVICE 0 /* NULL event (for QD_GETEVENT ret) */
- #define MOUSE_DEVICE 1 /* mouse */
- #define KEYBOARD_DEVICE 2 /* main keyboard */
- #define TABLET_DEVICE 3 /* graphics tablet */
- #define AUX_DEVICE 4 /* auxiliary */
- #define CONSOLE_DEVICE 5 /* console */
- #define KNOB_DEVICE 8
- #define JOYSTICK_DEVICE 9
-
- #define MAXEVQ 64 /* must be power of 2 */
- #define EVROUND(x) ((x) & (MAXEVQ - 1))
- #define TABLET_RES 2
-
- typedef struct {
- unsigned int time;
- short x, y;
- } TimeCoord;
-
- /*
- * The event queue. This structure is normally included in the info
- * returned by the device driver.
- */
- typedef struct {
- Event *events;
- unsigned int eSize;
- unsigned int eHead;
- unsigned int eTail;
- unsigned long timestampMS;
- TimeCoord *tcs; /* history of pointer motions */
- unsigned int tcSize;
- unsigned int tcNext; /* simple ring buffer, old events are tossed */
- } EventQueue;
-
- /*
- * mouse cursor position
- */
- typedef struct {
- short x;
- short y;
- } Cursor;
-
- /*
- * mouse motion rectangle
- */
- typedef struct {
- short bottom;
- short right;
- short left;
- short top;
- } Box;
-
- /*
- * Structures used by iocontrols.
- */
- typedef struct {
- char nbytes; /* Number of bytes in parameter */
- unsigned char cmd; /* Command to be sent, peripheral bit will */
- /* be forced by driver */
- unsigned char par[2]; /* Bytes of parameters to be sent */
- } KpCmd;
-
- typedef struct {
- EventQueue eventQueue; /* event & motion queues */
- short mswitches; /* current value of mouse buttons */
- Cursor tablet; /* current tablet position */
- short tswitches; /* current tablet buttons NI! */
- Cursor cursor; /* current cursor position */
- short row; /* screen row */
- short col; /* screen col */
- short maxRow; /* max character row */
- short maxCol; /* max character col */
- short maxX; /* max x position */
- short maxY; /* max y position */
- short maxCurX; /* max cursor x position */
- short maxCurY; /* max cursor y position */
- int version; /* version of driver */
- char *bitmap; /* bit map position */
- short *scanmap; /* scanline map position */
- short *cursorBits; /* cursor bit position */
- short *vaddr; /* virtual address */
- char *planeMask; /* plane mask virtual location */
- Cursor mouse; /* atomic read/write */
- Box mbox; /* atomic read/write */
- short mthreshold; /* mouse motion parameter */
- short mscale; /* mouse scale factor (if
- negative, then do square). */
- short minCurX; /* min cursor x position */
- short minCurY; /* min cursor y position */
- } ScreenInfo;
-
- typedef struct {
- short map;
- unsigned short index;
- struct {
- unsigned short red;
- unsigned short green;
- unsigned short blue;
- } entry;
- } ColorMap;
-
-
-